﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Admin.master" AutoEventWireup="true"
    CodeFile="GiaBanDinhMuc.aspx.cs" Inherits="GiaBanDinhMuc" %>
    <%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
    <asp:UpdatePanel ID="up1" runat="server">
        <ContentTemplate>
            <div class="panel panel-success margin">
                <div class="panel-heading">
                    <h3 class="panel-title">
                        Quản lý giá bán theo định mức
                        <asp:DropDownList ID="dlThang"  runat="server" Width="150px" CssClass="form-control">
                        </asp:DropDownList>
                        <asp:DropDownList ID="dlNam" 
                            runat="server" Width="110px" CssClass="form-control">
                        </asp:DropDownList>
                        </h3>
                </div>
                <div class="panel-body">
                    <asp:GridView ID="GridView1" Visible="true" AutoGenerateColumns="false" runat="server"
                        BackColor="White" Font-Size="14px" Width="100%" BorderColor="#CCCCCC" EmptyDataText="Không có dữ liệu nào"
                        BorderStyle="None" BorderWidth="1px" CellPadding="3" EnableModelValidation="True"
                        OnRowDeleting="GridView1_RowDeleting">
                        <Columns>
                            <asp:BoundField DataField="RowNumber" HeaderText="STT" HeaderStyle-Width="50px" HeaderStyle-HorizontalAlign="Center"
                                ItemStyle-HorizontalAlign="Center"></asp:BoundField>
                            <asp:TemplateField HeaderText="Loại vật liệu" ItemStyle-HorizontalAlign="Center"
                                HeaderStyle-HorizontalAlign="Center">
                                <ItemTemplate>
                                    <asp:DropDownList ID="dlLoaiVL" CssClass="form-control" runat="server" 
                                    DataTextField="TenLoaiVL" DataValueField="IDs" DataSourceID="objLoaiVL"></asp:DropDownList>
                                    <asp:RequiredFieldValidator ID="RequiredFieldValidator4111" ValidationGroup="add"
                                        runat="server" ControlToValidate="dlLoaiVL" ErrorMessage="Chọn loại vật liệu"
                                        Display="None" Text="*"></asp:RequiredFieldValidator>
                                </ItemTemplate>
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="Giá có VAT" ItemStyle-HorizontalAlign="Center">
                                <ItemTemplate>
                                    <asp:TextBox ID="txtGiaCoVAT" Style="text-align: center;" runat="server" Width="98%"></asp:TextBox>
                                    <cc1:FilteredTextBoxExtender ID="FilteredTextBoxExtender9" runat="server" FilterType="Custom,Numbers"
                            TargetControlID="txtGiaCoVAT" ValidChars=",." />
                                </ItemTemplate>
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="Giá không VAT" ItemStyle-HorizontalAlign="Center">
                                <ItemTemplate>
                                    <asp:TextBox ID="txtGiaKhongVAT" Style="text-align: center;" runat="server" Width="98%"></asp:TextBox>
                                    <cc1:FilteredTextBoxExtender ID="FilteredTextBoxExtender19" runat="server" FilterType="Custom,Numbers"
                            TargetControlID="txtGiaKhongVAT" ValidChars=",." />
                                </ItemTemplate>
                            </asp:TemplateField>
                            <asp:CommandField HeaderText="Xóa" ItemStyle-HorizontalAlign="Center" HeaderStyle-Width="45px"
                                ShowDeleteButton="True" DeleteText="Xóa" />
                        </Columns>
                        <FooterStyle BackColor="#6EA1C0" ForeColor="#000066" />
                        <HeaderStyle BackColor="#6EA1C0" Font-Bold="True" ForeColor="White" Height="40px"
                            HorizontalAlign="Center" VerticalAlign="Middle" />
                        <PagerStyle BackColor="#FFFFCC" ForeColor="#330099" HorizontalAlign="Center" />
                        <RowStyle ForeColor="#000066" Height="30px" />
                        <SelectedRowStyle BackColor="#F1F1F1" Font-Bold="True" />
                    </asp:GridView>
                    <asp:Button ID="btnNew" ValidationGroup="Them" runat="server" Style="margin-left: 5px; margin-top:5px;"
                            Text="Thêm vật liệu" CssClass="btn btn-warning" OnClick="btnNew_Click" />
                            
                            <asp:Button ID="btnSave" ValidationGroup="Them" runat="server" Style="margin-left: 5px; margin-top:5px;"
                                    Text="Lưu lại" CssClass="btn btn-primary" OnClick="btnAdd_Click" />
                                <asp:Button ID="btncapnhat" runat="server" Text="Cập nhật" CssClass="btn btn-info" Style="margin-left: 5px; margin-top:5px;"
                                    OnClick="btnUpdate_Click" Visible="false" />
                                <asp:Button ID="btnCancel" runat="server" Text="Nhập mới" CssClass="btn btn-warning" Style="margin-left: 5px; margin-top:5px;"
                                    OnClick="btnCancel_Click" />


                    <asp:HiddenField ID="hdTuNgay" runat="server" />
                    <asp:HiddenField ID="hdDenNgay" runat="server" />
                    <asp:ValidationSummary ID="ValidationSummary1" HeaderText="Bạn phải nhập các trường sau:"
                        ShowMessageBox="true" ValidationGroup="Them" ShowSummary="false" EnableClientScript="true"
                        runat="server" />
                        <asp:ObjectDataSource ID="objLoaiVL" runat="server" SelectMethod="GetLoaiVL" TypeName="clsXuLy">
                    </asp:ObjectDataSource>
                </div>
            </div>
            <div style="margin: 5px;">
                <div class="panel panel-default">
                    <div class="panel-heading">
                        <b>Bảng giá bán theo định mức</b>
                        <asp:DropDownList ID="dlThangLoc"  runat="server" Width="150px" CssClass="form-control">
                        </asp:DropDownList>
                        <asp:DropDownList ID="dlNamLoc" 
                            runat="server" Width="110px" CssClass="form-control">
                        </asp:DropDownList>
                        <asp:Button ID="btnSearch" runat="server" Text="Tìm kiếm" CssClass="btn btn-warning" Style="margin-left: 5px; margin-top:5px;"
                                    OnClick="btnSearch_Click" />
                        </div>
                    <div style="width: 100%; margin-top: 0px;" class="wrapper">
                        <asp:GridView ID="GV" runat="server" AutoGenerateColumns="false" BackColor="White"
                            BorderColor="#CCCCCC" BorderStyle="None" BorderWidth="1px" CellPadding="1" EmptyDataText="Không có dữ liệu nào"
                            EnableModelValidation="True" ShowFooter="false" CssClass="form-control withall"
                            Width="99%" OnRowCommand="GV_RowCommand">
                            <Columns>
                                <asp:TemplateField HeaderText="Xóa" ItemStyle-HorizontalAlign="Center" HeaderStyle-Width="50px"
                                    ItemStyle-Width="50px">
                                    <ItemTemplate>
                                        <asp:ImageButton ID="lbXoa" runat="server" Width="20px" Height="20px" ImageUrl="~/img/delete-24.png"
                                            OnClientClick="return confirm('Bạn chắc chắn muốn xóa ?')" CommandArgument='<%#Eval("IDs")%>'
                                            Text="Xóa" CommandName="Del" />
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="Sửa" ItemStyle-HorizontalAlign="Center" HeaderStyle-Width="50px"
                                    ItemStyle-Width="50px">
                                    <ItemTemplate>
                                        <asp:ImageButton ID="lbSua" runat="server" Width="15px" Height="15px" ImageUrl="~/img/edit.ico"
                                            CommandArgument='<%#Eval("IDs")%>' Text="Sửa" CommandName="Select" />
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:BoundField DataField="ThoiGian" ItemStyle-CssClass="padding" HeaderText="Tháng"
                                    HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Center" />
                                <asp:BoundField DataField="LoaiVL" ItemStyle-CssClass="padding" HeaderText="Vật liệu"
                                    HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Left" />
                                <asp:BoundField DataField="GiaCoVAT" ItemStyle-CssClass="padding" HeaderText="Giá có VAT"
                                    HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Right" />
                                <asp:BoundField DataField="GiaKhongVAT" ItemStyle-CssClass="padding" HeaderText="Giá không VAT"
                                    HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Right" />
                                
                            </Columns>
                            <FooterStyle BackColor="White" ForeColor="#000066" Font-Bold="True" HorizontalAlign="Left" />
                            <HeaderStyle BackColor="White" Font-Bold="True" ForeColor="Black" Height="30px" />
                            <PagerStyle BackColor="White" ForeColor="#000066" HorizontalAlign="Left" />
                            <RowStyle BackColor="White" ForeColor="#000066" Height="30px" />
                            <SelectedRowStyle BackColor="Lavender" Font-Bold="false" />
                        </asp:GridView>
                        <div style="margin: 5px;">
                            <asp:Button ID="btnFirst" runat="server" Text="Đầu" CssClass="btn btn-primary" OnClick="btnFirst_Click" />
                            <asp:Button ID="btnPre" runat="server" Style="margin-left: 5px;" Text="Trước" CssClass="btn btn-primary"
                                OnClick="btnPre_Click" />
                            <asp:Button ID="btnNext" runat="server" Style="margin-left: 5px;" Text="Sau" CssClass="btn btn-warning"
                                OnClick="btnNext_Click" />
                        </div>
                    </div>
                </div>
                <asp:HiddenField ID="hdID" runat="server" />
            </div>
        </ContentTemplate>
    </asp:UpdatePanel>
</asp:Content>
